package com.gx.wisestone.android.grpc.interceptor.uaa;

import io.grpc.CallOptions;
import io.grpc.Channel;
import io.grpc.ClientCall;
import io.grpc.ClientInterceptor;
import io.grpc.MethodDescriptor;

/**
 * @author xiaosy
 * @create 2020/7/22
 * @Describe
 **/
public class UAAClientInterceptor implements ClientInterceptor {
    private UAAClientCall.Provider provider;

    public UAAClientInterceptor(UAAClientCall.Provider provider) {
        this.provider = provider;
    }

    @Override
    public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
        return new UAAClientCall<>(next.newCall(method, callOptions), provider);
    }
}
